PCTG R Markdown template
logo

Loading data


The earthquake data is from USGS.gov. Variables in the dataset and their meanings:

  • time: Time when the event occurred. Times are reported in milliseconds since the epoch ( 1970-01-01T00:00:00.000Z), and do not include leap seconds. In certain output formats, the date is formatted for readability.
  • latitude: Decimal degrees latitude. Negative values for southern latitudes.
  • longitude: Decimal degrees longitude. Negative values for western longitudes.
  • depth: Depth of the event in kilometers.
  • mag: The magnitude for the event.
  • magType: The method or algorithm used to calculate the preferred magnitude for the event.
  • place: Textual description of named geographic region near to the event.

Show data


library(DT)
datatable(
  data, 
  rownames = FALSE, 
  filter = "top", 
  options = list(pageLength = 10, scrollX = T)
)

Earthquake happend time


The Box-Pierce statistic value is 2.2e-16.

p <- data %>% 
  count(localhour) %>% 
  ggplot(aes(localhour, n)) + 
  geom_col() + 
  labs(x = 'hour', title = 'earthquake happend hour histogram', 
       subtitle = 'mag level >= 2.5', 
       caption = 'dataSource: USGS.gov') + 
  theme_minimal()

ggplotly(p)

Earthquake happend time in different mag


The Box-Pierce statistic value is 0.4589.

p <- data %>% 
  mutate(mag_level = case_when(
    mag >= 4.5 ~ '4.5+', 
    mag >= 4 ~ '4-4.5', 
    mag >= 3 ~ '3-4', 
    .default = '2.5-3'
  )) %>% 
  mutate(box_test = Box.test(localhour)$p.value, .by = mag_level) %>% 
  count(mag_level, localhour, box_test) %>%
  ggplot(aes(localhour, n)) + 
  geom_col() + 
  facet_wrap(~ paste(mag_level, box_test, sep = ':'), scales = 'free') + 
  labs(x = 'hour', title = 'earthquake happend hour histogram in different mag', 
       caption = 'dataSource: USGS.gov') + 
  theme_minimal()

ggplotly(p)

Earthquake happend time in China


The Box-Pierce statistic value is 3.527e-07.

p <- data_china %>% 
  count(localhour) %>% 
  ggplot(aes(localhour, n)) + 
  geom_col() + 
  labs(x = 'hour', title = 'earthquake happend hour histogram in China', 
       subtitle = 'mag level >= 0', 
       caption = 'dataSource: USGS.gov') + 
  theme_minimal()

ggplotly(p)
 




A work by ashther